package org.myOrg.spetrum.spectrumStruct;

import org.myOrg.spetrum.SpecificAlogrithm.SpectrumAnalyseDeepFirst;
import org.myOrg.spetrum.SpecificAlogrithm.SpectrumAnalyseGreedy;
import org.myOrg.spetrum.SpecificAlogrithm.SpectrumAnalysePath;
import org.myOrg.spetrum.SpecificAlogrithm.SpectrumAnalyseWidthFirst;

public class SpectrumFactory {
	public static final int BASE = 0;
	public static final int  DEEPFIRST = 1;
	public static final int WIDTHFIRST = 2;
	public static final int GREEDY = 3;
	public static final int PATH = 4;

	public static final String[] NAMES= {"Base" , "DeepFirst" ,"widthFrist" ,"greedy" ,"path"};
	
	public static final int  ALORGRITMNUM =  NAMES.length;
	
	public static Spectrum generateSpectrum(int type){
		Spectrum  result  = null;
		if(type == BASE){
			result = new SpetrumAnalyseBase();
		}else if(type == DEEPFIRST){
		   result = new SpectrumAnalyseDeepFirst();
		}
		else if(type == WIDTHFIRST){
			result = new SpectrumAnalyseWidthFirst();
		}
		else if(type == GREEDY){
			result = new SpectrumAnalyseGreedy();
		}
		else if(type == PATH){
			result = new SpectrumAnalysePath();
		}

		return result;
	}
	
	public static String getName(int type){
		if(type < ALORGRITMNUM)
			return NAMES[type];
		else 
			return "unKnown Alogrithm";
	}
}
